<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改页面</title>
    <link rel="stylesheet" href="/static/pengpai/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">

            <input type="hidden" name="qrId" lay-verify="required" lay-reqtext="用户名不能为空" placeholder="请输入参数名" th:value="${qrcode.qrId}" READONLY class="layui-input">

            <div class="layui-form-item">
                <label class="layui-form-label">二维码名称</label>
                <div class="layui-input-block">
                    <input type="text" value="" lay-verify="title" autocomplete="off" th:value="${qrcode.qrcodeName}" readonly
                           placeholder="请输入标题" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <img th:src="@{(${img})}">
                </div>
            </div>


        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="/static/pengpai/component/layui/layui.js"></script>
<script src="/static/pengpai/component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery'], function() {
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(user-save)', function(data) {
            console.log(data)
            $.get("/qrcode/download",data.field,function(r){
                console.info(r.code);
                if(r.code === 200){
                    parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
                    parent.location.reload();
                }else{
                    layer.msg('提交失败！');
                }
            });
        });
    })
</script>
<script>
</script>
</body>
</html>
